#ifndef SAMEGAME_H
#define SAMEGAME_H
#define pole(x,y) (field[(x)+(y)*(width_)])
#include <vector>
struct SGPoint
{
    int x,y;
    //Group(Group &g):x(g.x),y(g.y){}
    SGPoint(int x_,int y_) :x(x_),y(y_){}

};
class sameGame
{
private:
    const int width_,height_,colors_;
    int *field;
    std::vector<SGPoint> groups;
    bool changed;
    int score;
    int partialScore;
    std::vector<SGPoint> tmpGroup;
    void addNextElement(int x,int y,int color, sameGame &copy);
public:
    sameGame(int width,int height,int colors);
    sameGame(sameGame &sg);
    sameGame(int predefinied);
    void load();
    void save();
    ~sameGame();
    bool click(int x,int y);
    bool groupExist();
    void flip();
    int *getField(){return field;}// :D
    int &getColor(int x,int y) {return pole(x,y);}
    int w(){return width_;}
    int h(){return height_;}
    void clearColor(int x,int y,int color);
    int colors(){return colors_;}
    int groupCount();
    int getResult();
    int getScore();
    std::vector<SGPoint>getElementsOfGroup(int x,int y);
    void setColor(int x,int y,int color);

    std::vector<SGPoint> &getGroups();
};


#endif // SAMEGAME_H

